drop procedure TinhTienVe

create procedure TinhTienVe
	@maLoaiVe int,
	@maKhuyenMai int,
	@TongTien float output
as
begin tran
SET TRAN ISOLATION LEVEL REPEATABLE READ
	declare @tiLeGiam float
	set @tiLeGiam = (select TiLeGiam from KHUYENMAI where MaKhuyenMai = @maKhuyenMai)

	declare @giaVe float
	set @giaVe = (select GiaVe from LOAIVE where MaLoaiVe = @maLoaiVe)

	set @TongTien = @giaVe - @giaVe * @tiLeGiam / 100
commit
go

declare @tongTien float
execute TinhTienVe 1, 1, @tongTien output
print @tongTien